Skip to content

fix(camera): report the camera's negotiation role, not the client's - #256

Merged
cleithner-comcast merged 2 commits into
feature/camerasfrom
cleith/dev/negotiationRole
Aug 4, 2026
Merged

fix(camera): report the camera's negotiation role, not the client's#256
cleithner-comcast merged 2 commits into
feature/camerasfrom
cleith/dev/negotiationRole

Conversation

@cleithner-comcast

Copy link
Copy Markdown
Contributor

The ep/webrtc negotiationRole resource is the camera's data model, so it now reports the CAMERA's WebRTC role — offerer when the camera generates the offer (SolicitOffer flow), answerer when it answers the client's offer (ProvideOffer flow) — instead of the role the client must take. An intrinsic cameraIsOfferer() predicate drives both the reported role and the (unchanged) Matter flow selection. The reference app inverts the reported value to choose its own role.

The Matter signaling sequence is unchanged. Driver, reference app, the camera unit test (adds NegotiationRoleReportsCameraRole), and the webrtc-signaling- endpoint / camera-stream-reference-command specs are updated to the camera perspective; archives the openspec change.

The ep/webrtc negotiationRole resource is the camera's data model, so it now
reports the CAMERA's WebRTC role — offerer when the camera generates the offer
(SolicitOffer flow), answerer when it answers the client's offer (ProvideOffer
flow) — instead of the role the client must take. An intrinsic cameraIsOfferer()
predicate drives both the reported role and the (unchanged) Matter flow
selection. The reference app inverts the reported value to choose its own role.

The Matter signaling sequence is unchanged. Driver, reference app, the camera
unit test (adds NegotiationRoleReportsCameraRole), and the webrtc-signaling-
endpoint / camera-stream-reference-command specs are updated to the camera
perspective; archives the openspec change.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR inverts the ep/webrtc/r/negotiationRole contract so it reports the camera’s WebRTC negotiation role (offerer/answerer) rather than the client’s, and updates the in-tree consumer (reference app), SBMD driver logic, specs, and unit tests to match.

Changes:

  • SBMD driver: introduce a cameraIsOfferer() predicate and use it to (a) report the camera’s role via readNegotiationRole and (b) keep executeLocalSdp’s Matter flow selection unchanged.
  • Reference app: invert the reported camera role to derive the client’s webrtcbin role.
  • OpenSpec + tests: update specs to the camera perspective and add a unit test asserting the updated role mapping.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
reference/src/cameraDeviceSession.h Clarifies GetRole() returns the camera’s role (client uses opposite).
reference/src/cameraDeviceSession.c Updates role caching/read commentary to camera-perspective semantics.
reference/src/cameraCategory.c Inverts negotiation role interpretation to derive the client’s role.
core/deviceDrivers/matter/sbmd/specs/camera.sbmd.js Implements camera-perspective role reporting via cameraIsOfferer(); keeps signaling flow selection aligned.
core/test/src/SbmdCameraWebrtcTest.cpp Adds NegotiationRoleReportsCameraRole and a helper to invoke read handlers with supplements.
openspec/specs/webrtc-signaling-endpoint/spec.md Updates endpoint contract: negotiationRole now reports the camera’s role and defaults accordingly.
openspec/specs/camera-stream-reference-command/spec.md Updates reference-app command contract to invert the camera-reported role.
openspec/changes/archive/2026-08-03-negotiation-role-camera-perspective/tasks.md Archives implementation checklist for the contract inversion.
openspec/changes/archive/2026-08-03-negotiation-role-camera-perspective/specs/webrtc-signaling-endpoint/spec.md Archived delta spec reflecting the updated negotiationRole requirement.
openspec/changes/archive/2026-08-03-negotiation-role-camera-perspective/specs/camera-stream-reference-command/spec.md Archived delta spec reflecting reference-app inversion behavior.
openspec/changes/archive/2026-08-03-negotiation-role-camera-perspective/proposal.md Archived proposal describing the breaking contract inversion and scope.
openspec/changes/archive/2026-08-03-negotiation-role-camera-perspective/design.md Archived design describing predicate-based refactor and unchanged Matter flow selection.
openspec/changes/archive/2026-08-03-negotiation-role-camera-perspective/.openspec.yaml Archives change metadata.

Comment thread reference/src/cameraCategory.c
Comment thread core/test/src/SbmdCameraWebrtcTest.cpp Outdated
Comment thread core/test/src/SbmdCameraWebrtcTest.cpp Outdated

@tleacmcsa tleacmcsa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with it after addressing copilot's comments.

- cameraCategory.c: validate the camera's negotiation role and fail early with a
  clear error on NULL/unknown, instead of silently defaulting to a role that
  could drive the wrong signaling flow.
- SbmdCameraWebrtcTest.cpp: rename OFFERER_ACCEPTED_CMDS -> CAMERA_ANSWERER_
  ACCEPTED_CMDS and SOLICIT_ACCEPTED_CMDS -> CAMERA_OFFERER_ACCEPTED_CMDS to
  match the camera-perspective contract; un-wrap a header-comment bullet.
Copilot AI review requested due to automatic review settings August 4, 2026 13:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Suppressed comments (1)

openspec/specs/webrtc-signaling-endpoint/spec.md:14

  • The Purpose section still describes negotiationRole as telling the client whether it is the offerer/answerer, which contradicts the updated contract below (the table row now says it reports the camera’s role and the client adopts the opposite). Updating the Purpose text avoids ambiguity for spec readers.
| `localSdp` | `function` | execute | Client posts its local SDP (offer or answer) to drive signaling |
| `negotiationRole` | `string` | [read] | Reports the **camera's** negotiation role (`offerer` or `answerer`); the client adopts the opposite role |
| `remoteSdp` | `string` | [] (events only) | Delivers the camera's remote SDP (offer or answer) to client |

@cleithner-comcast
cleithner-comcast merged commit 4a2b647 into feature/cameras Aug 4, 2026
6 checks passed
@cleithner-comcast
cleithner-comcast deleted the cleith/dev/negotiationRole branch August 4, 2026 18:39
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants